// 定义 URL 路径和页面组件的对应关系（点按钮后跳转到哪）
import { createRouter, createWebHistory } from 'vue-router' 
import Home from '../views/Home.vue'
import TaskDetail from '../views/TaskDetail.vue'
import CompletedTasks from '../views/CompletedTasks.vue'
import PendingTasks from '../views/PendingTask.vue'
//定义路由配置//
const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/pending',
    name: 'PendingTasks',
    component: PendingTasks
  },
  {
    path: '/task/:id',
    name: 'TaskDetail',
    component: TaskDetail,
    props: true
  },
  {
    path: '/completed',
    name: 'CompletedTasks',
    component: CompletedTasks
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router